cmake_minimum_required(VERSION 3.0)
project( IMPAUTO )

# Create an INTERFACE target
add_library( ${PROJECT_NAME} INTERFACE )
target_include_directories( ${PROJECT_NAME}
  INTERFACE
    ${PROJECT_SOURCE_DIR}/include
)
target_link_libraries( ${PROJECT_NAME}
  INTERFACE
    ${PROJECT_SOURCE_DIR}/lib/libautosdk.so
)
target_compile_options( ${PROJECT_NAME}
  INTERFACE
    -w  # Suppress all warnings
)

# Build test if building inside the project
get_directory_property(BuiltFromOutside PARENT_DIRECTORY)
if(NOT BuiltFromOutside)
    add_executable(main ${PROJECT_SOURCE_DIR}/test/test.cpp)
    target_link_libraries(main
        IMPAUTO
    )
    target_compile_options(main
        PRIVATE
            -Wno-format
            -Wno-format-security
            -Wno-unused-value
            -Wno-unused-variable
            -Wno-unused-but-set-variable
            -Wall
            -fsigned-char
            -fpic
            -fno-short-enums
            -fshort-wchar
            -fno-exceptions
            -std=c++11
            "$<$<CONFIG:Debug>:-g3>"
            "$<$<CONFIG:Debug>:-O0>"
            "$<$<CONFIG:Debug>:-rdynamic>"
            "$<$<CONFIG:Debug>:-ffloat-store>"
            "$<$<CONFIG:Debug>:-D_DEBUG>"
    )
    set_target_properties(main PROPERTIES 
        RUNTIME_OUTPUT_DIRECTORY ./bin
    )
endif()
